#!/bin/sh

# Slackware build script for Eduke32 HRP (High Res Pack)

# Written by B. Watson (yalhcru@gmail.com)

PRGNAM=eduke32_hires_pack
VERSION=${VERSION:-20070427}
ZIPFILE=dn3d_hrp-27-04-2007.zip
ARCH=${ARCH:-noarch}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}

CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

set -e

rm -rf $PKG
mkdir -p $TMP $PKG/usr/share/games/eduke32 $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
mkdir $PRGNAM-$VERSION
cd $PRGNAM-$VERSION
unzip $CWD/$ZIPFILE
chmod 644 *.*
chmod 755 autoload autoload/duke3d.grp

# 20080810 bkw: sd_duke stuff doesn't seem to work
rm -f sd_duke.*

chown -R root:root .
mv autoload $PKG/usr/share/games/eduke32/autoload

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a *.txt *.TXT $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
cat $CWD/README > $PKG/usr/doc/$PRGNAM-$VERSION/README

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc

cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz
